This invention relates to nonvolatile memories, and more particularly to updating data stored in nonvolatile memories.
Some modern computer systems use a type of nonvolatile memory device referred to as xe2x80x9cFlash memoryxe2x80x9d or xe2x80x9cFlash RAMxe2x80x9d. Flash memory is a type of electrically erasable programmable read-only memory (EEPROM) that can be erased and reprogrammed in units of memory cells referred to as xe2x80x9cblocksxe2x80x9d. Data can be written into and read from the Flash memory analogous to other types of conventional memories.
Flash memories can be used as a replacement for other types of nonvolatile storage media (e.g., other read only memories (ROMs) or magnetic disks) as well as more traditional types of system memory (e.g., random access memory (RAM)). When using Flash memory, data can be transferred from the Flash memory to a volatile system memory before being accessed by a processor in the system. Alternatively, the data can be accessed directly from the Flash memory. For example, instructions can be xe2x80x9cexecuted in placexe2x80x9d from the Flash memory, not requiring the instructions to be transferred to volatile system memory before being executed by the processor.
Typically, however, current Flash memories do not allow instructions to be executed in place while the Flash memory is being written to. This limitation makes it difficult to update instructions in the Flash memory, often requiring the updating to be performed by an individual possessing special knowledge and/or skill rather than by the typical computer user.
This problem can be aggravated if appropriate care is not taken to ensure that the updating of the Flash memory is carried out completely. That is, if the computer is turned off during the updating process, the results can be disastrous. This is particularly true when, for example, an operating system in the Flash memory is being updated. If the computer is turned off while the operating system is being updated, the operating system may not function properly (or at all) when the computer is next restarted.
The invention described below addresses these disadvantages, providing an improved way to update instructions and/or data in Flash memory.
A computer system includes a Flash or other nonvolatile memory. A program(s) to coordinate data transfers is loaded into a volatile system memory to transfer data from an external device to the Flash memory. The data transferred from the external device to the Flash memory can be transferred to a previously unused portion of the Flash memory, or alternatively can overwrite a previously used portion of the Flash memory.
According to one aspect of the invention, the computer operating system is temporarily re-configured to use only a portion of the volatile system memory. Another portion (a reserved portion) of the system memory is not made available to the operating system and is used to store a temporary operating system and the new data to be copied to the Flash memory. The new data is copied from the external device to the reserved portion and is verified. By copying the new data into the system memory, any errors in copying the data from the external device can be detected before the Flash memory is affected. The data is then copied from the reserved portion to the Flash memory, and again verified.
According to another aspect of the invention, data is copied from the external device to the Flash memory on a portion by portion basis, each portion being made up of one or more bytes of data. The portions are transferred according to an order in which a set of critical portions is transferred last. If the system were to lose power during the updating process, the system can still function so long as the previous versions of the critical portions in the Flash memory have not been overwritten yet. Thus, transferring the set of critical portions last makes the system more tolerant to accidental power losses during the updating process.